home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #4 / Amiga Plus CD - 2000 - No. 4.iso / Tools / Grafik / Misc / ImageEnginer / ARexx / Restore.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  2000-02-14  |  2.8 KB  |  151 lines

  1. /*
  2.  
  3.    v1.03 Restore
  4.  
  5.    Marko Seppänen
  6.    marko.seppanen@wwnet.fi
  7.  
  8. */
  9.  
  10.  
  11. address IMAGEENGINEER
  12.  
  13. Options results
  14. signal on error
  15.  
  16.  
  17. NL='0a'x
  18.  
  19.  
  20.  
  21. if exists("ie:prefs/shutdownimagelist.cfg") == 0 then do
  22.  
  23.   'REQUEST "There is nothing to restore!" "Sorry"'
  24.    exit
  25.  
  26. end
  27.  
  28.  
  29. PROJECT_LIST
  30. imagelist=result
  31.  
  32.  
  33. if imagelist ~== "" then do
  34.  
  35.   'REQUEST "Would you like to close current'||NL||'windows before proceeding?" "Yes|No|Cancel"'
  36.  
  37.   if result = 0 then exit
  38.   if result = 1 then do
  39.  
  40.     if exists("IE:Arexx/CloseAll.rexx") then ADDRESS COMMAND "Sys:Rexxc/RX IE:Arexx/CloseAll.rexx"
  41.     else do
  42.  
  43.      'REQUEST "Can not close windows.'||NL||'Download latest version of Image Engineer." "Continue|Stop"'
  44.      if result = 0 then exit
  45.  
  46.     end
  47.  
  48.   end
  49.  
  50. end
  51.  
  52.  
  53.  
  54. if exists("ie:prefs/shutdown.cfg") == "1" then
  55.   do
  56.     call open("temp","ie:prefs/shutdown.cfg","R")
  57.     values=readln("temp")
  58.     parse var values ok fileformat savepath .
  59.     call close("temp")
  60.   end
  61. else
  62.   do
  63.     'REQUEST "Error requester appeared!" "My fault, sorry"'
  64.     if result = 0 then exit
  65.   end
  66.  
  67.  
  68. savepath=strip(savepath,B,'"')
  69.  
  70.  
  71.  
  72.  
  73. call open("temp","ie:prefs/shutdownimagelist.cfg","R")
  74.  
  75. do forever
  76.  
  77.   fullline=readln("temp")
  78.   if fullline == "" then call settings
  79.  
  80.   select
  81.  
  82.     when word(fullline,1) == "PRIMARY" then primarypic=word(fullline,2)
  83.     when word(fullline,1) == "ALPHA" then alphapic=word(fullline,2)
  84.     when word(fullline,1) == "SECONDARY" then secpic=word(fullline,2)
  85.  
  86.     otherwise do
  87.  
  88.       parse var fullline iname pictype piczoom picx picy posx posy winwidth winheight .
  89.  
  90.       if pictype == "GREY" then OPEN "'"savepath||iname"'" GREY
  91.       else OPEN "'"savepath||iname"'" COLOUR
  92.  
  93.       imagename=iname
  94.  
  95.       PROJECT_SET imagename ZOOM piczoom
  96.       i=0;do until i=2000;i=i+1;end
  97.  
  98.       PROJECT_SET imagename WINDOW posx posy winwidth winheight
  99.       i=0;do until i=2000;i=i+1;end
  100.  
  101.       PROJECT_SET imagename OFFSETS picx picy
  102.  
  103.       ADDRESS COMMAND "c:delete "savepath||iname" QUIET"
  104.  
  105.     end
  106.  
  107.   end
  108.  
  109. end
  110.  
  111.  
  112.  
  113. exit
  114.  
  115.  
  116.  
  117.  
  118. settings:
  119.  
  120.   call close("temp")
  121.  
  122.   if secpic ~== "" then MARK secpic SECONDARY
  123.   if alphapic ~== "" then MARK alphapic ALPHA
  124.   if primarypic ~== "" then MARK primarypic PRIMARY
  125.  
  126.   ADDRESS COMMAND "c:delete ie:prefs/shutdownimagelist.cfg QUIET"
  127.  
  128.   exit
  129.  
  130.  
  131.  
  132.  
  133.  
  134. /*******************************************************************/
  135. /* This is where control goes when an error code is returned by IE */
  136. /* It puts up a message saying what happened and on which line     */
  137. /*******************************************************************/
  138. error:
  139. if RC=5 then do            /* Did the user just cancel us? */
  140.     IE_TO_FRONT
  141.     LAST_ERROR
  142.     'REQUEST "'||RESULT||'"'
  143.     exit
  144. end
  145. else do
  146.     IE_TO_FRONT
  147.     LAST_ERROR
  148.     'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
  149.     exit
  150. end
  151.